import pygame

#button class
class Button():
	def __init__(self, image, initial_pos):
		self.image = image
		self.rect = self.image.get_rect()
		self.rect.x = initial_pos[0]
		self.rect.y = initial_pos[1]
		self.clicked = False

	def draw(self, surface):
		is_active = False

		mouse_pos = pygame.mouse.get_pos()
		if self.rect.topleft[0] <= mouse_pos[0] and self.rect.topleft[1]<=mouse_pos[1] and self.rect.bottomright[0] >= mouse_pos[0] and self.rect.bottomright[1]>=mouse_pos[1]:
			if pygame.mouse.get_pressed()[0] == 1 and self.clicked == False:
				self.clicked = True
				is_active = True

		if pygame.mouse.get_pressed()[0] == 0:
			self.clicked = False


		surface.blit(self.image, self.rect)
		# pygame.draw.rect(surface, (255,255,255), self.rect, 1)


		return is_active